﻿using Storage.Core.Librs;
using Storage.Mapping.AppStorage;
using Storage.Mapping.Bucket;
using Storage.Mapping.BucketCut;
using Storage.Mapping.BucketImages;
using Storage.Mapping.Category;
using Storage.Mapping.Setting;
using Storage.Mapping.SysDomain;
using Storage.Mapping.SysPermission;
using Storage.Mapping.SysRole;
using Storage.Mapping.SysStore;
using Storage.Mapping.SysUser;
using Storage.Mapping.SysUserLoginLog;
using Storage.Mapping.SysUserToken;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Storage.Mapping
{
   public static class MappingExtensions
    {
        private static TDestination mapTo<TSource, TDestination>(this TSource source)
        {
            return MapperManager.Map<TSource, TDestination>(source);
        }
         

        #region SysUser

        /// <summary>
        /// 
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static Entities.SysUser toEntity(this SysUserMapping model)
        {
            return mapTo<SysUserMapping, Entities.SysUser>(model);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="source"></param>
        /// <returns></returns>
        public static SysUserMapping toModel(this Entities.SysUser source)
        {
            return mapTo<Entities.SysUser,SysUserMapping>(source);
        }
        #endregion

        #region SysRole

        /// <summary>
        /// 
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static Entities.SysRole toEntity(this SysRoleMapping model)
        {
            return mapTo<SysRoleMapping, Entities.SysRole>(model);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="source"></param>
        /// <returns></returns>
        public static SysRoleMapping toModel(this Entities.SysRole source)
        {
            return mapTo<Entities.SysRole, SysRoleMapping>(source);
        }
        #endregion

        #region SysUserLoginLog

        /// <summary>
        /// 
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static Entities.SysUserLoginLog toEntity(this SysUserLoginLogMapping model)
        {
            return mapTo<SysUserLoginLogMapping, Entities.SysUserLoginLog>(model);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="source"></param>
        /// <returns></returns>
        public static SysUserLoginLogMapping toModel(this Entities.SysUserLoginLog source)
        {
            return mapTo<Entities.SysUserLoginLog, SysUserLoginLogMapping>(source);
        }

        #endregion

        #region SysPermission

        /// <summary>
        /// 
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static Entities.SysPermission toEntity(this PermissionRecordMapping model)
        {
            return mapTo<PermissionRecordMapping, Entities.SysPermission>(model);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="source"></param>
        /// <returns></returns>
        public static PermissionRecordMapping toModel(this Entities.SysPermission source)
        {
            return mapTo<Entities.SysPermission, PermissionRecordMapping>(source);
        }
        #endregion

        #region SysStore

        /// <summary>
        /// 
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static Entities.SysStore toEntity(this SysStoreMapping model)
        {
            return mapTo<SysStoreMapping, Entities.SysStore>(model);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="source"></param>
        /// <returns></returns>
        public static SysStoreMapping toModel(this Entities.SysStore source)
        {
            return mapTo<Entities.SysStore, SysStoreMapping>(source);
        }
        #endregion

        #region SysUserToken

        /// <summary>
        /// 
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static Entities.SysUserToken toEntity(this SysUserTokenMapping model)
        {
            return mapTo<SysUserTokenMapping, Entities.SysUserToken>(model);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="source"></param>
        /// <returns></returns>
        public static SysUserTokenMapping toModel(this Entities.SysUserToken source)
        {
            return mapTo<Entities.SysUserToken, SysUserTokenMapping>(source);
        }
        #endregion
         

        #region Setting

        /// <summary>
        /// 
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static Entities.Setting toEntity(this SettingMapping model)
        {
            return mapTo<SettingMapping, Entities.Setting>(model);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="source"></param>
        /// <returns></returns>
        public static SettingMapping toModel(this Entities.Setting source)
        {
            return mapTo<Entities.Setting, SettingMapping>(source);
        }
        #endregion

        #region Category

        /// <summary>
        /// 
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static Entities.Category toEntity(this CategoryMapping model)
        {
            return mapTo<CategoryMapping, Entities.Category>(model);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="source"></param>
        /// <returns></returns>
        public static CategoryMapping toModel(this Entities.Category source)
        {
            return mapTo<Entities.Category, CategoryMapping>(source);
        }
        #endregion

        #region BucketImages

        /// <summary>
        /// 
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static Entities.BucketImage toEntity(this BucketImagesMapping model)
        {
            return mapTo<BucketImagesMapping, Entities.BucketImage>(model);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="source"></param>
        /// <returns></returns>
        public static BucketImagesMapping toModel(this Entities.BucketImage source)
        {
            return mapTo<Entities.BucketImage, BucketImagesMapping>(source);
        }
        #endregion

        #region AppStorage

        /// <summary>
        /// 
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static Entities.AppStorage toEntity(this AppStorageMapping model)
        {
            return mapTo<AppStorageMapping, Entities.AppStorage>(model);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="source"></param>
        /// <returns></returns>
        public static AppStorageMapping toModel(this Entities.AppStorage source)
        {
            return mapTo<Entities.AppStorage, AppStorageMapping>(source);
        }
        #endregion

        #region Bucket

        /// <summary>
        /// 
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static Entities.Bucket toEntity(this BucketMapping model)
        {
            return mapTo<BucketMapping, Entities.Bucket>(model);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="source"></param>
        /// <returns></returns>
        public static BucketMapping toModel(this Entities.Bucket source)
        {
            return mapTo<Entities.Bucket, BucketMapping>(source);
        }
        #endregion

        #region BucketCut

        /// <summary>
        /// 
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static Entities.BucketCut toEntity(this BucketCutMapping model)
        {
            return mapTo<BucketCutMapping, Entities.BucketCut>(model);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="source"></param>
        /// <returns></returns>
        public static BucketCutMapping toModel(this Entities.BucketCut source)
        {
            return mapTo<Entities.BucketCut, BucketCutMapping>(source);
        }
        #endregion
    }
}
